#include <stdio.h>
#include <stdlib.h>
#include <csp_spu.h>
#include <csp_debug.h>
#include "../ct.h"


int global_pid; 


int Run(){

	int pid = csp_pid();
	global_pid = csp_pid();

	int n __attribute__ ((aligned(16)));

	n = 0; // Initial value

	csp_channel out = 
		csp_create_channel(ANY2ONE_CHANNEL, A_CHANNEL, sizeof(int));

	csp_channel_write(out, &n); /* kickstart */

	csp_process identity =
		csp_create_process("ct_identity");

	csp_run_process(identity);


	ASSERT( pid == csp_pid() );
	ASSERT( global_pid == csp_pid() );

	PRINTF_FOR_TESTING("%s terminating on spe #%i with pid %i\n",__FILE__ , csp_spe_id(), pid);

	PRINTF_FOR_TESTING("Nested task with pid=%i terminated with res=%i.\n", pid, res);

	return 0;
}
